<?php

namespace App\Models\DylistModels;

use App\Models\ParentModel;
use ClassesWithParents\D;
use DB;
use App\Components\Tools;
use Log;

/**
 * 抖音实时热点词聚合视频
 * @author puppet
 */
class DyHotsearchVideo extends ParentModel
{
    /**
     * 与模型关联的数据表。
     *
     * @var string
     */
    protected $table = 'pt_dy_hotsearch_video';

    /**
     * DB::直接操作的数据库表名
     * @var string
     */
    protected $db_table = 'pt_dy_hotsearch_video';

    /**
     * 主键 默认id。
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * 指定是否模型应该被戳记时间。
     *
     * @var bool
     */
    public $timestamps = false;


    function upadinfo($data)
    {
     //  echo '<pre/>'; print_r($data);exit();

        $date = array(
            'wid'=>$data['wid'],
            'share_url'=>$data['share_url'],
            'title'=>$data['title'],
            'cover'=>$data['cover'],
            'item_id'=>$data['item_id'],
            'video_status'=>$data['video_status'],
            'comment_count'=>$data['comment_count'],
            'digg_count'=>$data['digg_count'],
            'download_count'=>$data['download_count'],
            'forward_count'=>$data['forward_count'],
            'play_count'=>$data['play_count'],
            'share_count'=>$data['share_count'],
            'create_time' =>$data['create_time'],
            'update_time' =>$data['update_time'],
        );
        DB::table($this->table)->insertGetId($date);
    }

    //插入热点词榜数据
    function upHotsearchWord($date)
    {
        set_time_limit(0);
        foreach ($date as $k => $v) {
            $data = array(
                'hot_level' => $v['hot_level'],
                'sentence' => $v['sentence'],
                'create_time' => date('Y-m-d H:i:s', time()),
                'update_time' => date('Y-m-d H:i:s', time()),
            );
            DB::table($this->table)->insertGetId($data);

        }
    }

}